using System;
using System.Collections.Generic;
using System.Text;

namespace tKitchen
{
    public class Meal
    {
        int mealId;
        string name;
        List<Meal_Recipe> recipes;
        double rating;
        List<MealComment> comments;

        #region Properties
        public int MealId
        {
            get { return mealId; }
            set { mealId = value; }
        }
        public string Name
        {
            get { return name; }
            set { name = value; }
        }
        public List<Meal_Recipe> Recipes
        {
            get { return recipes; }
            set { recipes = value; }
        }
        public double Rating
        {
            get { return rating; }
            set { rating = value; }
        }

        public List<MealComment> Comments
        {
            get { return comments; }
            set { comments = value; }
        }
        #endregion

        public Meal()
        {
            mealId = -1;
            recipes = new List<Meal_Recipe>();
            comments = new List<MealComment>();
        }
        public Meal(MealPO poIn)
        {
            this.mealId = poIn.MealId;
            this.recipes = new List<Meal_Recipe>();
            foreach (Meal_RecipePO obj in poIn.Recipes)
            {
                recipes.Add(new Meal_Recipe(obj));
            }

            name = poIn.Name;
            this.rating = poIn.Rating;


        }



        internal Meal Copy()
        {
            Meal temp = new Meal();

            foreach (MealComment comm in this.Comments)
            {
                temp.Comments.Add(comm);
            }

            temp.MealId = this.MealId;
            temp.Name = this.Name;
            temp.Rating = this.Rating;

            foreach (Meal_Recipe rec in this.Recipes)
            {
                temp.Recipes.Add(rec);
            }



            return temp;
        }
    }
}
